﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace ObservePattern
{
    public abstract class ObervableBase : IObservable
    {
        private Hashtable _oberverContainer = new Hashtable();

        public void Register(IObserver anObserver)
        {
            _oberverContainer.Add(anObserver, anObserver);
        }

        public void UnRegister(IObserver anOberver)
        {
            _oberverContainer.Remove(anOberver);
        }

        public void NotifyObservers(object anObject) 
        {
            foreach (IObserver item in _oberverContainer.Keys)
            {
                item.Notify(anObject);
            }
        }
    }
}
